package com.tingyuge.base.thread.wang.chapter6;

public class ThreadInterruptMain {
    public static void main(String[] args) {
        Thread t1 =new Thread(()->{
            System.out.println("t1 线程");
            while (true){

            }
        });
        t1.start();
        Thread main = Thread.currentThread();

        Thread t2 = new Thread(()->{
            main.interrupt();
        });
        t2.start();
        try {
            t1.join();
        } catch (InterruptedException e) {
            System.out.println("线程打断");
            e.printStackTrace();
        }
    }
}
